﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Data
{
    public interface IDataAccessBase
    {
        DbSet<T> GetTable<T>() where T : class;
        T GetRecordById<T>(params object[] propertyObjects) where T : class;
        List<T> GetAllRecord<T>() where T : class;
        //List<T> GetRecordsByProperty<T>(string propertyName, object propertyObject) where T : class;
        List<T> GetRecordsByProperty<T>(Expression<Func<T, bool>> predicate) where T : class;
        T GetRecordByProperty<T>(Expression<Func<T, bool>> predicate) where T : class;
        bool CheckRecordByProperty<T>(Expression<Func<T, bool>> predicate) where T : class;
        T InsertRecord<T>(T insertData) where T : class;
        List<T> InsertRecords<T>(IList<T> insertDatas) where T : class;
        bool DeleteRecord<T>(T deleteData) where T : class;
        T UpdateRecord<T>(T changedData) where T : class;

        List<T> GetLastRecordsByProperty<T, TF>(Expression<Func<T, bool>> predicate, Expression<Func<T, TF>> orderField)
            where T : class;

        List<T> GetRecordsByProperty<T, TF>(Expression<Func<T, TF>> orderField, int limit, bool desc = false) where T : class;
    }
}
